package com.marsrover;

public class RectangularPlateau implements Plateau {
	private int upperRightX;
	private int upperRightY;

	public RectangularPlateau(String plateauInfo) {
		try {
			String[] rangeCoordinates = plateauInfo.split(" ");
			upperRightX = Integer.parseInt(rangeCoordinates[0]);
			upperRightY = Integer.parseInt(rangeCoordinates[1]);
		} catch (NumberFormatException e) {
			throw new PlateauFormatException();
		}
	}

	@Override
	public boolean isInside(int x, int y) {
		return (x >= 0 && x <= upperRightX) && (y >= 0 && y <= upperRightY);
	}
}
